﻿@model Fengsoft.AIBlog.Web.Models.CarouselModel
@if (Model.Items.Any())
{
    string id=Model.ID;
    string itemClass=string.Empty;
    if (string.IsNullOrWhiteSpace(id))
    {
        id=string.Format("carousel_{0}",Guid.NewGuid());
    }
    <div id="@id" class="carousel slide carousel-v1">
        <div class="carousel-inner">
            @for (int i=0; i<Model.Items.Count; i++)
            {
                CarouselItemModel item=Model.Items[i];
                if (i==0)
                {
                    itemClass="item active";
                }
                else
                {
                    itemClass="item";
                }
                <div class="@itemClass">
                    <img src="@Url.Content(item.ImageUrl)" alt="@item.Caption" />
                    <div class="carousel-caption">
                        <p>@item.Caption</p>
                    </div>
                </div>
            }
        </div>
        <div class="carousel-arrow">
            <a class="left carousel-control" href="#@id" data-slide="prev">
                <i class="fa fa-angle-left"></i>
            </a>
            <a class="right carousel-control" href="#@id" data-slide="next">
                <i class="fa fa-angle-right"></i>
            </a>
        </div>
    </div>
}
